<?php
$host = 'localhost';
$username = '';
$password = '';
$dbname = '';

$mysql = new mysqli($host, $username, $password, $dbname);
if ($mysql->connect_errno) {
    die('数据库连接失败：' . $mysql->connect_errno);
} else {
    $sql = "select * from readerinfo";
    $result = $mysql->query($sql);
}
?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>All Information</title>
</head>

<body>
    <table width="800px" border="1" style="border-collapse: collapse;">
        <thead>
            <th>姓名</th>
            <th>id</th>
            <th>借阅资格(1:有 0:无)</th>
            <th>当前借阅量</th>
        </thead>
        <?php
        while ($row = mysqli_fetch_row($result)) {
        ?>
            <tr>
                <td align="center"><?php echo $row[0]; ?></td>
                <td align="center"><?php echo $row[1]; ?></td>
                <td align="center"><?php echo $row[2]; ?></td>
                <td align="center"><?php echo $row[3]; ?></td>
            </tr>
        <?php
        }
        ?>
    </table>
    <br>
    <a href="homepage.html">返回首页</a>
</body>

</html>